<?php

/**
 * file form base class.
 *
 * @method file getObject() Returns the current form's model object
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasefileForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'ID'         => new sfWidgetFormInputHidden(),
      'ClassName'  => new sfWidgetFormChoice(array('choices' => array('File' => 'File', 'Image' => 'Image', 'Folder' => 'Folder', 'Image_Cached' => 'Image_Cached'))),
      'Created'    => new sfWidgetFormDateTime(),
      'LastEdited' => new sfWidgetFormDateTime(),
      'Name'       => new sfWidgetFormInputText(),
      'Title'      => new sfWidgetFormInputText(),
      'Filename'   => new sfWidgetFormTextarea(),
      'Content'    => new sfWidgetFormTextarea(),
      'Sort'       => new sfWidgetFormInputText(),
      'ParentID'   => new sfWidgetFormInputText(),
      'OwnerID'    => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'ID'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('ID')), 'empty_value' => $this->getObject()->get('ID'), 'required' => false)),
      'ClassName'  => new sfValidatorChoice(array('choices' => array(0 => 'File', 1 => 'Image', 2 => 'Folder', 3 => 'Image_Cached'), 'required' => false)),
      'Created'    => new sfValidatorDateTime(array('required' => false)),
      'LastEdited' => new sfValidatorDateTime(array('required' => false)),
      'Name'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'Title'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'Filename'   => new sfValidatorString(array('required' => false)),
      'Content'    => new sfValidatorString(array('required' => false)),
      'Sort'       => new sfValidatorInteger(array('required' => false)),
      'ParentID'   => new sfValidatorInteger(array('required' => false)),
      'OwnerID'    => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('file[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'file';
  }

}
